home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / WRITEF.CA < prev    next >
Text File  |  1993-04-04  |  1KB  |  60 lines

  1. #include <dos.h>
  2. writef(int row, int col, int attr, char *mch)
  3. /* This will do a direct video write of the character ch. It will be
  4.    placed at location row,col using attribute attr.
  5. */
  6. {
  7.   extern int color, mono, cga, ega, scrseg, bios;
  8.   int   scrofs, *pattr, orow, ocol ,x;
  9.   char pchar;
  10.   char far *base;
  11.   char far *work;
  12.   if(mono) base=(char far *)0xb0000000;
  13.   else base=(char far *)0xb8000000;
  14.   if(bios) {
  15.           get_cur(&orow,&ocol);
  16.         locate(row,col) ;
  17.         while(*mch) {
  18.             put_ca(*mch,attr,1);
  19.             cur_rt();
  20.             mch++;
  21.         }
  22.         locate(orow,ocol);
  23.         return(0);
  24.   }
  25.     scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
  26.     work = base + scrofs;
  27.     while(*mch) {
  28.         pchar = *mch;
  29.         asm mov cl,pchar
  30.         asm les bx,work
  31.         if(cga) {
  32.             asm     mov    dx,03dah
  33.             asm        in    al,dx
  34.             asm        test al,1
  35.             asm        jnz $-3
  36.             asm        in    al,dx
  37.             asm        test al,1
  38.             asm        jz $-3
  39.         }
  40.             asm mov byte ptr es:[bx],cl
  41.         work++;
  42.         pchar = attr;
  43.         asm mov cl,pchar
  44.         asm les bx,work;
  45.         if(cga) {
  46.             asm     mov    dx,03dah
  47.             asm        in    al,dx
  48.             asm        test al,1
  49.             asm        jnz $-3
  50.             asm        in    al,dx
  51.             asm        test al,1
  52.             asm        jz $-3
  53.         }
  54.         asm mov byte ptr es:[bx],cl
  55.         work++;
  56.         mch++;
  57.     }
  58.   return(0);
  59. }
  60.